<%@ page contentType="text/html;charset=utf-8" %>
<%@ page import="ut.data.User" %>
<%@ page import="ut.data.Message" %>
<%
	User user = (User)session.getAttribute("user");
%>

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="Description" content="協助案主找到適合的專業翻譯人員，也協助譯者利用專業的語言能力賺取外快，我們致力於創造完善的線上翻譯媒合管理工具，建立案主與譯者間的互動橋樑。" />
	<title>UT終極一翻！</title>
	<link rel="stylesheet" type="text/css" href="/style.css" media="all" />
	<script type="text/javascript" src="/js/Utility.js"></script>
	<script type="text/javascript" src="/js/Message.js"></script>
	<script type="text/javascript" src="/js/Ajax.js"></script>
	<script type="text/javascript" src="/js/Button.js"></script>
	<script type="text/javascript" src="/js/Account.js"></script>
	<script type="text/javascript" src="script.js"></script>
</head>
<body onload="init();">
	<div class="homepage">
		<div class="header">
			<img src="/image/header.png" />
		</div>
		<div class="subtitle">
			<div class="subtitle-1">簡單。安全。快速</div>
			<div class="subtitle-2">線上翻譯媒合管理平台</div>
		</div>
		<div id="tool" class="button-div">
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="document.location='/task-list-select.jsp'">
				我要接案
			</button>
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="document.location='/task-create-select.jsp'">
				我要發案
			</button>
<%
	if(user == null){
%>
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="Message.show('msg-register', 470, '註冊會員', Account.Register.instance);Account.Register.name.focus();">
				註冊
			</button>
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="Message.show('msg-login', 470, '登入會員', Account.Login.instance);Account.Login.email.focus();">
				登入
			</button>
<%
	}else{
		int newMsgCount = Message.getNewMessageCount(user.id);
		if(newMsgCount == 0){
%>
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="document.location='/account/user-info.jsp'">
				個人管理
			</button>
<%
		}else{
%>
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="document.location='/account/user-info.jsp'">
				個人管理
				<span class="alert"><%= newMsgCount %>
			</button>
<%
		}
%>
			<button class="button large"
					onmousedown="this.style.borderStyle='inset';"
					onmouseup="this.style.borderStyle='outset';"
					onmouseout="this.style.borderStyle='outset';"
					onclick="logout();">
				登出
			</button>
<%
	}
%>
			<img src="/image/arrow2.png" style="margin-top:30px" />
		</div>
	</div>
	<div class="block" style="text-align:center;padding:50px;box-shadow:0px 0px 15px black;margin-bottom:50px">
		<img src="/image/cash-flow.png" />
	</div>
	<div style="position:absolute;top:0px;right:20px;">
		<a href="/event.jsp">
			<img title="點擊查看活動說明" src="/image/event.png" border="0" />
		</a>
	</div>
	<script>
		(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
		(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
		m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
		})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

		ga('create', 'UA-10373112-13', 'pada-x.com');
		ga('send', 'pageview');
	</script>
</body>
</html>